package cn.tedu.antcolony.passport.controller;


import cn.tedu.antcolony.passport.pojo.vo.RoleListVo;
import cn.tedu.antcolony.passport.service.IRoleServer;
import cn.tedu.antcolonycommons.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/role")
@Api(tags = "02.角色管理模块")
@Slf4j
@Validated
@CrossOrigin
public class RoleController {

    @Autowired
    private IRoleServer iRoleServer;

    /**
     * 查询所有角色名称
     * @return
     */
    @GetMapping("/list")
    @ApiOperation("查询角色名称")
    @ApiOperationSupport(order = 100)
    public JsonResult<List<RoleListVo>> list(){
        List<RoleListVo> list = iRoleServer.list();
        return JsonResult.ok(list);
    }
}
